package com.sunwayworld.basemodule.coredata.experimentaltemplate.resource.impl;

import com.sunwayworld.basemodule.coredata.experimentaltemplate.resource.LimsExperimentalTemplateResource;
import com.sunwayworld.basemodule.coredata.experimentaltemplate.service.LimsExperimentalTemplateService;
import com.sunwayworld.basemodule.coredata.experimentaltemplate.validators.LimsExperimentalTemplateDeleteTableValidator;
import com.sunwayworld.framework.log.annotation.Log;
import com.sunwayworld.framework.log.annotation.LogModule;
import com.sunwayworld.framework.log.annotation.LogType;
import com.sunwayworld.framework.restful.data.RestJsonWrapperBean;
import com.sunwayworld.framework.spring.annotation.GikamBean;
import com.sunwayworld.framework.validator.data.annotation.ValidateDataWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@LogModule("实验模板管理")
@RestController
@GikamBean
public class LimsExperimentalTemplateResourceImpl implements LimsExperimentalTemplateResource {

    @Autowired
    private LimsExperimentalTemplateService limsExperimentalTemplateService;

    @Override
    public LimsExperimentalTemplateService getService() {
        return limsExperimentalTemplateService;
    }

    @Log(value = "新增实验模板管理", type = LogType.INSERT)
    @Override
    @RequestMapping(method = RequestMethod.POST)
    public Long insert(RestJsonWrapperBean wrapper) {
        return getService().insert(wrapper);
    }

    @Log(value = "删除", type = LogType.DELETE)
    @Override
    @ValidateDataWith(LimsExperimentalTemplateDeleteTableValidator.class)
    public void delete(RestJsonWrapperBean wrapper) {
        getService().delete(wrapper);
    }
}
